package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

@Getter@Setter
public class Strategy extends BaseDomain{
    public final static int STATE_NORMAL=0;//正常

    public final static int STATE_DISABLE=-1;//禁用

    public final static int STATE_COMMENT=1;//推荐

    private Region place;//所属地区

    private String title;//攻略标题

    private String subTitle;//攻略子标题

    private String coverUrl;//封面

    private Integer state=STATE_NORMAL;//状态


    public String getStateName(){
        String msg = "正常";
        if (state==STATE_COMMENT) {
            msg = "推荐";
        }else if (state==STATE_DISABLE) {
            msg = "禁用";
        }
        return  msg;
    }

    public String getJson(){
        Map<String,Object> map = new HashMap();
        map.put("id",id);
        if(place!=null) {
            map.put("placeId", place.getId());
        }
        map.put("title",title);
        map.put("subTitle",subTitle);
        map.put("coverUrl",coverUrl);
        map.put("state",state);
        return JSONUtil.toJSONString(map);
    }

}